Skip to content

perturbation-sim: resilience arc — meta-hop → buffer → exploration → fail-first scorecard#509

Merged
AdaWorldAPI merged 3 commits into
mainfrom
claude/jirak-math-theorems-harvest-rfii13
Jun 16, 2026
Merged

perturbation-sim: resilience arc — meta-hop → buffer → exploration → fail-first scorecard#509
AdaWorldAPI merged 3 commits into
mainfrom
claude/jirak-math-theorems-harvest-rfii13

Conversation

@AdaWorldAPI

Copy link
Copy Markdown
Owner

What

Builds on the #504 base (the eigenvalue-perturbation + edge-propagation outage simulator) with the cognitive/decision layers and a spectral exploration battery. Purely additive to crates/perturbation-sim — nothing else in the workspace changes. 67 lib tests, clippy -D warnings clean, fmt clean.

New source modules (src/)

Module What
timing meta-hop cascade (tier i modifies i+1) + inertia × phase between-level model (bipolar phase composes, magnitude bundles, inertia = the clock) + the dimensionless collapse number Π
rolling_floor the L1–L4 HHTL eigenmode tiers as an HDR popcount-stacking, early-exit Belichtungsmesser cascade (preheated mu+kσ floor); weyl_over_fiedler mode-instability modifier
resilience λ₂ + Kirchhoff index Kf = n·trace(L⁺) — the perturbation-agnostic certificate read once from the self-inverse L⁺ reference
buffer impulse storage + Ketchup yield (sharp non-Newtonian threshold) — the transient axis, orthogonal to λ₂/Kirchhoff by construction

New examples

meta_hops, validate_mediators (Pearson / Spearman / Cronbach α / ICC battery), modifier_validity, rolling_floor, resilience, buffer, explore (self-inverse + interlacing + equitability + analytic + N-2 probes), scorecard (cross-country fail-first investment locator).

Findings (real Iberian / European PyPSA cores; graded in PAPER.md §4.7–§4.13)

  • Engine sound [G]: self-inverse L↔L⁺ verified exact in code (Moore-Penrose identities to 1e-13); λ₂/Kf match exact path/cycle/complete closed forms.
  • Validity/reliability: Fiedler edge-sensitivity is the valid cascade-size predictor (ρ=0.77); ranking is reproducible (ICC 0.71, Cronbach α 0.91).
  • A confound found: m = Weyl×(1/Fiedler) was confounded with the Kirchhoff index (1/λ₂ is its dominant term). The buffer (inertia storage) is the genuinely independent axis (Spearman(λ₂, buffer) ≈ 0).
  • Resilience, not re-prediction: read the certificate once from L⁺ (integrates over all perturbations), dissolving the §4.9.1 circularity; the max-margin corridor raises λ₂ +136% / lowers Kf −27%.
  • Cross-country: equitability never holds on real grids; France's top cut is ambiguous (gap/λ₂=0.37); N-2 super-additivity up to 3.55×; the France paradox (lowest λ₂ yet stable via nuclear buffer) validates the two-axis split.
  • Fail-first investment locator: the binding constraint per country names the product — buffer-bound → synchronous inertia (gas turbine / sync-condenser / pumped storage), Spain −50 % (the largest single lever) — the predictive-vulnerability case.

Honest scope

Topology is measured from the PyPSA grid; inertia (H_eff) and policy are transparent priors (tagged [prior]), so scorecard percentages are structural, not costed — real per-bus inertia + curtailment data turns the same machine into a costed ROI per site. The DC/spectral layer remains a structural-vulnerability screen (the 28 Apr 2025 event was a voltage collapse — the AC fork's domain), per #504's framing.

Notes

https://claude.ai/code/session_01CcpLeEC3XK8Eye53GKBVvi


Generated by Claude Code

…fail-first scorecard

Builds on the #504 base (eigenvalue-perturbation + edge-propagation simulator),
adding the cognitive/decision layers and the spectral exploration battery. All
additive to crates/perturbation-sim; nothing else in the workspace changes.

New modules (src/): timing (meta-hop cascade + inertia×phase between-level model
+ collapse number), rolling_floor (HDR/Belichtungsmesser early-exit over the
L1-L4 HHTL eigenmode tiers + weyl_over_fiedler modifier), resilience (λ₂ +
Kirchhoff index = the self-inverse L⁺ certificate, read once), buffer (impulse
storage + Ketchup yield — the transient axis, orthogonal to λ₂/Kirchhoff).

New examples: meta_hops, validate_mediators (Pearson/Spearman/Cronbach α/ICC
battery), modifier_validity, rolling_floor, resilience, buffer, explore
(self-inverse + interlacing + equitability + analytic + N-2 probes), scorecard
(cross-country fail-first investment locator).

Findings (real Iberian/European PyPSA cores, all graded in PAPER §4.7-§4.13):
- self-inverse reference L↔L⁺ verified exact in code (MP identities 1e-13);
  analytic λ₂/Kf match path/cycle/complete closed forms — engine sound [G].
- validity battery: Fiedler edge-sensitivity is the valid cascade-size predictor
  (ρ=0.77); reliability ICC 0.71 / Cronbach α 0.91.
- the modifier m=Weyl×(1/Fiedler) was confounded with the Kirchhoff index
  (1/λ₂ is its dominant term); the BUFFER (inertia storage) is the genuinely
  independent axis (Spearman(λ₂,buffer)≈0).
- resilience as a perturbation-agnostic certificate (read once, never re-predict),
  dissolving the circularity; reinforcement raises λ₂ +136% / lowers Kf −27%.
- cross-country: equitability never holds on real grids; FR top cut ambiguous
  (gap/λ₂=0.37); N-2 super-additivity up to 3.55×; the France paradox (lowest λ₂
  yet stable via nuclear buffer) validates the two-axis split.
- fail-first investment locator: binding constraint → product (buffer→synchronous
  inertia; Spain −50%), the predictive-vulnerability case.

Honest scope: topology measured; inertia/policy are transparent priors. 67 lib
tests; clippy -D warnings clean; fmt clean.
@coderabbitai

coderabbitai Bot commented Jun 16, 2026

Copy link
Copy Markdown

Warning

Review limit reached

@AdaWorldAPI, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 27 minutes and 34 seconds. Learn how PR review limits work.

Your organization has used up its prepaid credits, and credit purchases are no longer available. Enable the review add-on in the billing tab to keep reviews running — you're only billed for reviews past your plan's rate limits ($0.25/file).

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: e977624d-f438-43ac-9daa-712ad2b7d471

📥 Commits

Reviewing files that changed from the base of the PR and between 0c6ef02 and 69da10f.

📒 Files selected for processing (17)
  • crates/perturbation-sim/COUNTRY_STUDY.md
  • crates/perturbation-sim/Cargo.toml
  • crates/perturbation-sim/METHODS.md
  • crates/perturbation-sim/PAPER.md
  • crates/perturbation-sim/examples/buffer.rs
  • crates/perturbation-sim/examples/explore.rs
  • crates/perturbation-sim/examples/meta_hops.rs
  • crates/perturbation-sim/examples/modifier_validity.rs
  • crates/perturbation-sim/examples/resilience.rs
  • crates/perturbation-sim/examples/rolling_floor.rs
  • crates/perturbation-sim/examples/scorecard.rs
  • crates/perturbation-sim/examples/validate_mediators.rs
  • crates/perturbation-sim/src/buffer.rs
  • crates/perturbation-sim/src/lib.rs
  • crates/perturbation-sim/src/resilience.rs
  • crates/perturbation-sim/src/rolling_floor.rs
  • crates/perturbation-sim/src/timing.rs

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b689f51013

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +44 to +47
let inv_sum: f64 = eigenvalues
.iter()
.filter(|&&l| l > tol)
.map(|&l| 1.0 / l)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge Preserve disconnected components in Kirchhoff index

When the spectrum has more than one zero mode (an islanded/disconnected graph), this filter drops all of those zero modes and sums only the finite component spectra, so e.g. [0, 0, 2, 2] returns a finite Kf even though cross-component effective resistance is infinite. The new resilience/scorecard paths use mean_resistance() as a resilience/exposure axis, so an already-disconnected compartment can be ranked as resilient instead of failing; detect modes < n - 1 and return INFINITY/invalid for that case.

Useful? React with 👍 / 👎.

Comment thread crates/perturbation-sim/src/timing.rs Outdated
Comment on lines +236 to +237
if field.abs() >= threshold {
depth += 1;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Base phase depth on the current tier amplitude

If a tier absorbs the perturbation (g == 0), signed_amp becomes zero for all following tiers, but field still contains the earlier seed; counting penetration from this cumulative field therefore reports every later tier as reached whenever the seed exceeded threshold. The synthetic meta_hops run already shows magnitude amplitudes 1,0,0,0,0 while the phase model reports depth 4, so downstream timing/exploration results overstate cascade penetration; count the current reachable contribution or stop once the propagated amplitude is below threshold.

Useful? React with 👍 / 👎.

claude added 2 commits June 16, 2026 15:37
… study (epiphanies-first)

A standalone, mathematically-verifiable study document: epiphanies-first abstract
(EN+DE), the formal three-axis model (topology λ₂/Kf measured · buffer · policy),
the per-country scorecard with detailed stats, the fail-first investment locator,
the validity/reliability battery, the [G] verification table (self-inverse 1.3e-13,
analytic closed forms, interlacing), honest scope, and a reproduction appendix
mapping every number to a named example + a grade ledger.

Headline: the France paradox — FR and ES have near-identical measured topology
(λ₂ 3.06e-7 vs 3.15e-7) yet 4.6× different exposure, recovered only by the
separated buffer/policy axes. Topology measured [G]; inertia/policy priors [S];
'predicts the blackout' explicitly NOT claimed (structural screen).
…on, P2 meta-hop depth)

P1 (resilience.rs): kirchhoff_index now returns INFINITY when the graph is
disconnected (finite modes < n−1, i.e. ≥2 zero modes). Previously it summed only
the live-component spectra and returned a FINITE Kf for a fragmented graph, which
would rank an already-disconnected compartment as resilient (low Kf) — backwards.
mean_resistance propagates ∞, so a disconnected basin now ranks most-exposed.
New test disconnected_graph_has_infinite_kirchhoff.

P2 (timing.rs): meta_cascade_phase penetration depth now counts the ARRIVING
contribution |signed_amp| (the front), not the cumulative interference field.
Once a tier absorbs the front (g→0) no deeper tier is reached, even though the
bundled field retains the earlier seed — the old field-based count overstated
reach (synthetic 1,0,0,0 reported depth 4). Front reach is gain-driven and
phase-independent (|±x|=x); phase governs the field interference, reported in the
MetaHop.field column. Test reframed (phase_governs_the_field_not_the_front_depth)
+ PAPER §4.7 corrected to the true ES number (front penetration 3/4, field peak
|Σ|=1.95) EN+DE; meta_hops label fixed.

68 lib tests; clippy -D warnings clean; scorecard/explore numbers unchanged
(connected components).

Copy link
Copy Markdown
Owner Author

Both Codex findings addressed in 69da10fe — both were real.

P1 — Kirchhoff index on disconnected graphs (resilience.rs). kirchhoff_index now detects finite modes < n−1 (i.e. ≥2 zero modes ⇒ disconnected) and returns INFINITY instead of summing only the live-component spectra. A fragmented compartment now correctly ranks as most exposed (∞ Kf → ∞ mean_resistance), not least. Added disconnected_graph_has_infinite_kirchhoff (two disjoint edges → ∞; single connected edge → finite). The published per-country scorecard numbers are unchanged because those use largest_component() (connected ⇒ exactly one zero mode).

P2 — meta-hop penetration depth (timing.rs). meta_cascade_phase now counts the arriving contribution |signed_amp| (the front), not the cumulative interference field. Once a tier absorbs the front (g→0) no deeper tier is reached. The synthetic case that reported depth 4 with magnitude 1,0,0,0 now reports the true front reach. Front reach is gain-driven and phase-independent (|±x|=x); phase governs the field interference, which stays in MetaHop.field for inspection. The test was reframed to phase_governs_the_field_not_the_front_depth (depth equal across phase patterns; field peak differs), and PAPER §4.7 corrected to the true ES figure — front penetration 3/4, field peak |Σ|=1.95 (EN+DE), plus the meta_hops print label.

68 lib tests pass, clippy -D warnings clean.


Generated by Claude Code

@AdaWorldAPI AdaWorldAPI merged commit f7734ff into main Jun 16, 2026
6 checks passed
AdaWorldAPI pushed a commit that referenced this pull request Jun 16, 2026
PR #511 merged 2026-06-16 19:01 UTC (merge commit c3dddfc) on main —
+886/-0 additive substrate calibration in perturbation-sim:
examples/calibrate.rs (ICC/Spearman/Pearson/Cronbach α battery against
perturbation-sim as ground truth), src/columns.rs (calibrated SoaMemberSpec,
spec only), src/hhtl.rs, examples/hhtl_grid.rs, CLAM_CHAODA_FRAMING.md.

Headline locks:
  - 5 contingency factors certify by VALUE at 2-bit linear (ICC ≥ 0.96) —
    existing palette/turbovec tenants suffice; §10 "statistics survive the
    encoding" CONFIRMED.
  - α preserved within Δ ≤ 0.02 at ≥4-bit; read ≥6-bit for orthogonality.
  - inertia_buffer is the one genuinely additive member — orthogonal to
    topology per #509 (Spearman(λ₂, buffer) ≈ 0). Spec only; promotion
    gated by §0 anti-invention guardrail.
  - d_lambda2's ICC=0 was a variance-guard underflow at ~1e-7 magnitude;
    two prior guesses (heavy-tail / near-constant) retracted on the run.
  - Significance per Jirak n^(p/2−1) (I-NOISE-FLOOR-JIRAK).
  - Does NOT touch the operator-locked canonical_node.

Files updated this commit:
  - PR_ARC_INVENTORY.md  PREPEND #511 entry
  - LATEST_STATE.md      dated bullet + Recently-Shipped row
  - AGENT_LOG.md         PREPEND session entry covering both
                         odoo-rs SEED (cross-repo, commit ebfb2c3 on
                         AdaWorldAPI/odoo-rs main) AND this #511
                         board hygiene.

Retroactive cleanup (merge landed before the same-commit hygiene rule
could fire — the AGENT_LOG entry records this).

https://claude.ai/code/session_01Xzyc27Nx3f8WC5KzwfWfjx
AdaWorldAPI pushed a commit that referenced this pull request Jun 16, 2026
PR #511 merged 2026-06-16 19:01 UTC (merge commit c3dddfc) on main —
+886/-0 additive substrate calibration in perturbation-sim:
examples/calibrate.rs (ICC/Spearman/Pearson/Cronbach α battery against
perturbation-sim as ground truth), src/columns.rs (calibrated SoaMemberSpec,
spec only), src/hhtl.rs, examples/hhtl_grid.rs, CLAM_CHAODA_FRAMING.md.

Headline locks:
  - 5 contingency factors certify by VALUE at 2-bit linear (ICC ≥ 0.96) —
    existing palette/turbovec tenants suffice; §10 "statistics survive the
    encoding" CONFIRMED.
  - α preserved within Δ ≤ 0.02 at ≥4-bit; read ≥6-bit for orthogonality.
  - inertia_buffer is the one genuinely additive member — orthogonal to
    topology per #509 (Spearman(λ₂, buffer) ≈ 0). Spec only; promotion
    gated by §0 anti-invention guardrail.
  - d_lambda2's ICC=0 was a variance-guard underflow at ~1e-7 magnitude;
    two prior guesses (heavy-tail / near-constant) retracted on the run.
  - Significance per Jirak n^(p/2−1) (I-NOISE-FLOOR-JIRAK).
  - Does NOT touch the operator-locked canonical_node.

Files updated this commit:
  - PR_ARC_INVENTORY.md  PREPEND #511 entry
  - LATEST_STATE.md      dated bullet + Recently-Shipped row
  - AGENT_LOG.md         PREPEND session entry covering both
                         odoo-rs SEED (cross-repo, commit ebfb2c3 on
                         AdaWorldAPI/odoo-rs main) AND this #511
                         board hygiene.

Retroactive cleanup (merge landed before the same-commit hygiene rule
could fire — the AGENT_LOG entry records this).

https://claude.ai/code/session_01Xzyc27Nx3f8WC5KzwfWfjx
AdaWorldAPI pushed a commit that referenced this pull request Jun 17, 2026
PR #511 merged 2026-06-16 19:01 UTC (merge commit c3dddfc) on main —
+886/-0 additive substrate calibration in perturbation-sim:
examples/calibrate.rs (ICC/Spearman/Pearson/Cronbach α battery against
perturbation-sim as ground truth), src/columns.rs (calibrated SoaMemberSpec,
spec only), src/hhtl.rs, examples/hhtl_grid.rs, CLAM_CHAODA_FRAMING.md.

Headline locks:
  - 5 contingency factors certify by VALUE at 2-bit linear (ICC ≥ 0.96) —
    existing palette/turbovec tenants suffice; §10 "statistics survive the
    encoding" CONFIRMED.
  - α preserved within Δ ≤ 0.02 at ≥4-bit; read ≥6-bit for orthogonality.
  - inertia_buffer is the one genuinely additive member — orthogonal to
    topology per #509 (Spearman(λ₂, buffer) ≈ 0). Spec only; promotion
    gated by §0 anti-invention guardrail.
  - d_lambda2's ICC=0 was a variance-guard underflow at ~1e-7 magnitude;
    two prior guesses (heavy-tail / near-constant) retracted on the run.
  - Significance per Jirak n^(p/2−1) (I-NOISE-FLOOR-JIRAK).
  - Does NOT touch the operator-locked canonical_node.

Files updated this commit:
  - PR_ARC_INVENTORY.md  PREPEND #511 entry
  - LATEST_STATE.md      dated bullet + Recently-Shipped row
  - AGENT_LOG.md         PREPEND session entry covering both
                         odoo-rs SEED (cross-repo, commit ebfb2c3 on
                         AdaWorldAPI/odoo-rs main) AND this #511
                         board hygiene.

Retroactive cleanup (merge landed before the same-commit hygiene rule
could fire — the AGENT_LOG entry records this).

https://claude.ai/code/session_01Xzyc27Nx3f8WC5KzwfWfjx
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants